package com.axend.aerosense.user.fragment;

import android.os.Bundle;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.axend.aerosense.base.fragment.MvvmBaseFragment;
import com.axend.aerosense.base.viewmodel.BaseViewModel;
import com.axend.aerosense.common.ui.CustomTipsDialog;
import com.axend.aerosense.common.util.FragmentUtil;
import com.axend.aerosense.user.R;
import com.axend.aerosense.user.UserSettingActivity;
import com.axend.aerosense.user.databinding.UserCancelNumberFragmentBinding;

public class UserCancelNumberFragment extends MvvmBaseFragment<UserCancelNumberFragmentBinding, BaseViewModel> {
    private CustomTipsDialog dialog;

    public static UserCancelNumberFragment getInstance() {
        UserCancelNumberFragment fragment = new UserCancelNumberFragment();
        return fragment;
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        ((UserSettingActivity)getActivity()).setTitle(getString(R.string.user_cancel_number));
        init();
    }
    private void init(){
        viewDataBinding.userButCancel.setOnClickListener(v->{
            dialog = new CustomTipsDialog(getActivity(),getString(R.string.user_is_cancel_number));
            dialog.setOnClickBottomListener(new CustomTipsDialog.OnClickBottomListener() {
                @Override
                public void onPositiveClick() {
                    dialog.dismiss();
                    //确认按钮
                    Fragment fragment = UserCancelNumberVerificationFragment.getInstance();
                    FragmentUtil.add(getActivity(),((UserSettingActivity)getActivity()).getContentId(),fragment,UserCancelNumberFragment.this,true);
                }

                @Override
                public void onNegtiveClick() {
                    //取消按钮
                    dialog.dismiss();
                }
            }).show();
        });
    }

    @Override
    public int getLayoutId() {
        return R.layout.user_cancel_number_fragment;
    }

    @Override
    public int getBindingVariable() {
        return 0;
    }

    @Override
    protected BaseViewModel getViewModel() {
        return null;
    }

    @Override
    protected void onRetryBtnClick() {

    }
}
